home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8186 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: habs.ee.ubc.ca!not-for-mail
  2. From: ellenh@ee.ubc.ca (Ellen Ho)
  3. Newsgroups: comp.lang.c
  4. Subject: How to make this code portable?
  5. Date: 1 Mar 1996 20:54:11 -0800
  6. Organization: University of BC, Dept. of Electrical Engineering
  7. Message-ID: <4h8k9j$78r@habs.ee.ubc.ca>
  8. NNTP-Posting-Host: habs.ee.ubc.ca
  9.  
  10. I am writing a program that I want to compile and run on both a Sun 
  11. Sparcstation and a PC running OS/2 Warp.  On the Sun, I compile the .c 
  12. files with gcc.  On the PC, I am using Visual Age.
  13.  
  14. The program acceptes a list of filenames as command line
  15. arguments and does some processing with the list of files.
  16. On the Sun, I specify 
  17.  
  18.         program *.txt
  19.  
  20. and the shell will expand the wildcard into the names of all .txt
  21. files in the current working directory.  So with a for loop in
  22. my C program I can go through each file and process the data.
  23.  
  24. However, on the PC, "*.txt" is passed into my program as
  25. command line argument as is.  This means that I may have to
  26. put in extra operating system dependent logic to expand the wildcard
  27. inside my program.
  28.  
  29. Are there other ways to handle this?
  30.  
  31. --
  32. Ellen Ho
  33. ellenh@ee.ubc.ca
  34.